<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="primus" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fn" tagdir="/WEB-INF/tags/form" %>
<primus:page title="省列表">
    <jsp:attribute name="css">
        <style type="text/css">
            #table .operate {
                min-width: 80px;
            }
        </style>
    </jsp:attribute>
    <jsp:attribute name="script">
        <script type="application/javascript">
            $(function () {
                $("#table").DataTable({
                    "lengthMenu": [[10, 20, 50, -1], [10, 20, 50, "所有"]],
                    "columnDefs": [{"targets": [6], "orderable": false}],
                    "searching": false,
                    "order": [[0, "asc"]]
                });
            });
            $("body").on("click", ".geo-line", function () {
                var id = $(this).data("id");
                console.log("id", id);
            })
        </script>
    </jsp:attribute>
    <jsp:body>
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="welcome.do">
                        首页
                    </a>
                </li>
                <li>
                    GEO管理
                </li>
                <li class="active">
                    省列表
                </li>
            </ul>
        </div>

        <div class="page-content">

            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->
                    <div class="row">
                        <div class="col-xs-12">
                            <h3 class="header smaller lighter blue">
                                省列表
                                <a href="geo/addProvince" class="btn small pull-right">添加</a>
                            </h3>
                            <div class="row">
                                <table id="table" class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>省ID</th>
                                        <th>省编码</th>
                                        <th>省名称</th>
                                        <th>百度名称</th>
                                        <th>前缀</th>
                                        <th>状态</th>
                                        <th class="operate">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach var="province" items="${springPage.content}">
                                        <tr data-id="<c:out value='${province.id}'/>" class="geo-line">
                                            <td><c:out value='${province.id}'/></td>
                                            <td><c:out value='${province.code}'/></td>
                                            <td><c:out value='${province.name}'/></td>
                                            <td><c:out value='${province.baiduname}'/></td>
                                            <td><c:out value='${province.prefix}'/></td>
                                            <td>${province.status eq 'ENABLE'?'启用':'禁用'}</td>
                                            <td>
                                                <a href="geo/<c:out value='${province.id}'/>/cities">
                                                    <i class=""></i>下级城市
                                                </a>
                                                <a href="geo/forwardToProvince/<c:out value='${province.id}'/>">
                                                    <i class=""></i>
                                                    详情
                                                </a>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <primus:springPagePagination url="geo/provinces" springPage="${springPage}"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </jsp:body>
</primus:page>